#include <iostream>
#include <algorithm>
using namespace std;
constexpr int MAXN = 15;
int n, sum = 0;
void dfs(int index);
int perm[MAXN];
int main() {
    cin >> n;
    dfs(0);
    cout << "dfs: " << sum << endl;
    int res = 0;
    for (int i = 0; i < n; i++) perm[i] = i;
    do {
        res++;
    } while (next_permutation(perm, perm + n));
    cout << "next_permutation: " << res << endl;
    return 0;
}

bool occupied[MAXN];
void dfs(int index) {
    if (index == n) { sum++; return; }
    for (int i = 0; i < n; i++) {
        if (!occupied[i]) {
            occupied[i] = true;
            dfs(index + 1);
            occupied[i] = false;
        }
    }
}
